<?php	
	$blogObj = $dataObj->GetInformation();
	if($blogObj != null)
	{
		$blogpost = $blogObj->GetBlogPosts();
		$comments = $blogObj->GetComments();
	}

	// If there is a blogpost set , print it out
	if(isset($blogpost) && $blogpost != null)
	{
		// Parse smileys
		echo 
			"<div class='blogPost'>
				<p class='detailsHead'>" 
					. "<span class='blogHeadline'>" . $blogpost->GetHeadline() . "</span>"
					. "<span class='blogDate'>" . substr($blogpost->GetPosted(),0,10) .
				"</p>
				<p>"  
					. nl2br(parse_smileys($blogpost->GetMessage(),base_url().'assets/images/smileys/smileys/')) . 
			   "</p>
			</div>";	
	}
	
	// Print potential validation errors
	if(isset($user) && $user != null)
	{
		echo 
		"<div class='validation'>"
			. validation_errors() .
		"</div>";
	}
	
	// If there are comments, print them out
	if(isset($comments) && $comments != null)
	{
		$count = 1;
		foreach($comments as $comment)
		{
			echo 
			"<div class='commentPost'>
				<p class='authorComment'>
					<strong>#". $count . "</strong> <small>" . substr($comment->GetPosted(),0,10) . "</small> by [" . $comment->GetAuthor() . "]
				</p>
				<p class='messageComment'>"
					. nl2br($comment->GetComment()) .
				"</p>
			</div>";
			$count++;
		}
	}
	
	// If user is logged
	if(isset($user) && $user != null)
	{
		// Configuration
		$data = array(
		    "id"	=> "newBlogCommentButton",
		    "name"	=> "newBlogCommentButton",
		    "type"	=> "submit",
		    "value" => "Comment");
		
		$attributes = array(
	    	"name"	=> "newBlogCommentForm",
	    	"id"	=> "newBlogCommentForm");
	    
	    // Printing
		echo
		"<div id='newBlogComment'>".
			form_open(current_url(), $attributes)
				."<p>". form_textarea("message") . "</p>"
				."<p>". form_submit($data) . "</p>" .
			form_close() . "
		</div>";
	}